package pcb.control 
{
	import com.intel.patterns.cairngorm.FrontController;
	import com.intel.utils.Debugger;
	import pcb.control.commands.Cmd_getLessonId;
	import pcb.control.commands.Cmd_loadLessonAssets;
	import pcb.control.commands.Cmd_loadLessonSwf;
	import pcb.control.commands.Cmd_loadLessonText;
	import pcb.control.commands.Cmd_loadLessonXml;
	import pcb.control.commands.Cmd_loadMenu;
	import pcb.control.commands.Cmd_loadPlayerConfig;
	import pcb.control.commands.Cmd_loadPlayerText;
	import pcb.control.commands.Cmd_processorChk;
	import pcb.control.commands.Cmd_resetLessonState;
	//import pcb.control.commands.Cmd_loadSharedAssets;
	import pcb.control.commands.Cmd_onSlideComplete;
	import pcb.control.commands.Cmd_respondToUserGesture;
	import pcb.control.commands.Cmd_onInteractivityComplete;
	import pcb.control.events.InteractionEvent;
	import pcb.control.events.LessonEvent;
	import pcb.control.events.LoadDataEvent;
	
	/**
	 * ...
	 * @author Fintan Boyle
	 */
	public class Controller extends FrontController 
	{
		
		public function Controller() 
		{
			super();
			initialise();
			Debugger.traceOut("Controller initialised");
		}
		
		private function initialise():void
		{
			addCommand(LoadDataEvent.LOAD_PLAYER_CONFIG, Cmd_loadPlayerConfig);//triggered at initialisation
			addCommand(LoadDataEvent.INTEL_PROCESSOR_CHECK, Cmd_processorChk);//triggered in Re_loadPlayerConfig
			addCommand(LoadDataEvent.RETRIEVE_LESSON_ID, Cmd_getLessonId);//triggered in Re_loadPlayerConfig or Re_processorChk
			addCommand(LoadDataEvent.LOAD_MAIN_MENU, Cmd_loadMenu);//triggered in Cmd_getLessonId>execute()
			addCommand(LoadDataEvent.LOAD_LESSON_SWF, Cmd_loadLessonSwf);//triggered in Cmd_getLessonId>execute()
			addCommand(LoadDataEvent.LOAD_PLAYER_TEXT, Cmd_loadPlayerText);//triggered in Re_loadPlayerConfig
			addCommand(LoadDataEvent.LOAD_LESSON_TEXT, Cmd_loadLessonText);//triggered in Re_loadLessonSwf
			addCommand(LoadDataEvent.LOAD_LESSON_XML, Cmd_loadLessonXml);//triggered in Re_loadLessonText
			addCommand(InteractionEvent.USER_GESTURE, Cmd_respondToUserGesture);//triggered from ViewMediator by user gesture
			addCommand(LessonEvent.SLIDE_COMPLETE, Cmd_onSlideComplete);//triggered from ViewMediator by bubbled event in swf
			addCommand(LessonEvent.INTERACTIVITY_COMPLETED, Cmd_onInteractivityComplete);//triggered from ViewMediator by bubbled event in swf
			addCommand(LessonEvent.CLEAR_LESSON, Cmd_resetLessonState);//triggered when a new lesson is clicked on from menu
			
			
		}
		
	}
	
}